layui.define(['table', 'form', 'upload', 'admin'], function (exports) {
    var $ = layui.$
        , table = layui.table
        , form = layui.form
        , upload = layui.upload
        , admin = layui.admin;

    //
    table.render({
        elem: '#LAY-give-manage'
        , url: '/admin/user/ajax_give_ticket_log?uid=' + $('#userId').val() + "&type=" + $("#type").val() + "&time_type=" + $("#time_type").val() + "&start_time=" + $("#start_time_input").val() + "&end_time=" + $("#end_time_input").val()
        , totalRow: true
        , cols: [[
            {field: 'id',  title: 'ID', sort: true, fixed: 'left'}
            , {
                field: 'type',title: '发放类型', templet: function (d) {
                    if (d.type == 0) {
                        return '';
                    }
                    switch (d.type) {
                        case 1:
                            return "老用户补发";
                        case 2:
                            return "新注册发放";
                        case 3:
                            return "签到游戏发放";
                        case 4:
                            return "绑定充值自动发放";
                        case 5:
                            return "人工发放";
                    }
                }
            }
            , {field: 'num', title: '数量'}
            , {field: 'create_time',  title: '下单时间'}
        ]]
        , page: true
        , limit: 20
        , height: 'full-140'
        , text: '对不起，加载出现异常！'
        , even: true
    });

    exports('user_give_ticket_log', {})
});